import requests
from lxml import etree

if __name__ == "__main__":
    url = 'https://www.qiushibaike.com/text/'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0'
    }
    page_text = requests.get(url=url, headers=headers).text
    tree = etree.HTML(page_text)
    div_list = tree.xpath('//div[@class="col1 old-style-col1"]/div')
    print(div_list)
    data = {
    }
    for div in div_list:
        author = div.xpath('./div[@class="author clearfix"]//h2/text()')
        print(author)
        content = div.xpath('.//div[@class="content"]/span/text()')
        print(content)

    print(data)
